<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script language="javascript" type="text/javascript" src="http://manager.zyttb.com/Public/Manage/Js/jquery.js"></script>
<script src="http://manager.zyttb.com/Public/Manage/Js/frame.js" language="javascript" type="text/javascript"></script>
<link href="http://manager.zyttb.com/Public/Manage/Css/style.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<script src="http://manager.zyttb.com/Public/Manage/Js/DD_belatedPNG.js" language="javascript" type="text/javascript"></script>
<script>
  DD_belatedPNG.fix('.nav ul li a,.top_link ul li,background');   /* string argument can be any CSS selector */
</script>
<![endif]-->
</head>
<body class="showmenu">
<script src="http://manager.zyttb.com/Public/Manage/Js/common.js" type="text/javascript"></script>
<script type="text/javascript">
    function clear_del()
    {
        if(confirm("确定要删除数据吗？"))
        {
            subform("<?php echo U('Game/Category', 'do=deleteAll');?>");
        }
    }
</script>
<table width="100%" height="31px" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
    <tr>
        <td height="31"><div class="titlebt">游戏列表</div></td>
    </tr>
</table>

<div class="main">
    <div class="operate">
        <div class="left">
            <input type="button" onclick="window.open('<?php echo U('Game/Lists', 'do=addGame');?>','main')" target="main" class="btn_blue" value="添加">
        </div>
        <div class="left_pad">
            <form method="get" action="<?php echo U('Game/Lists', 'do=Search');?>">
                <input type="text" name="keyword" title="关键字" class="inp_default" value="">
                <!-- 分类筛选 -->
                <!-- 分类筛选 -->
<select id="select0">
    <option value="0" class="selects">全部</option>
    <?php if(is_array($gamefl)): $i = 0; $__LIST__ = $gamefl;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo['class_id'] == $parent_id): ?><option value="<?php echo ($vo["class_id"]); ?>" class="selects" selected="selected"><?php echo ($vo["class_name"]); ?></option>
            <?php else: ?>
            <option value="<?php echo ($vo["class_id"]); ?>" class="selects"><?php echo ($vo["class_name"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; ?>
</select>
<select id="select1">
    <?php if(empty($gamefl2)): ?><option value="0" class="selects1">--</option>
    <?php else: ?>
        <?php if(is_array($gamefl2)): $i = 0; $__LIST__ = $gamefl2;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo['class_id'] == $children_id): ?><option value="<?php echo ($vo["class_id"]); ?>" selected="selected"><?php echo ($vo["class_name"]); ?></option>
                <?php else: ?>
                <option value="<?php echo ($vo["class_id"]); ?>"><?php echo ($vo["class_name"]); ?></option><?php endif; endforeach; endif; else: echo "" ;endif; endif; ?>
</select>
<input type="hidden" name="cid" id="category-id" value="<?php echo ($game["children_id"]); ?>" />
<script type="text/javascript">
    $(function(){
        $('#select0').change(function(){
            var val = $("#select0").val();
            if(val == 0){
                $("#select1").html('<option value="0">--</option>');
                $('#category-id').val('');
                return ;
            }

            $.ajax({
                type:'POST',
                url:"<?php echo U('Game/Lists', 'do=selectlist');?>",
                data:{
                    list1: val,
                },
                success:function(data){
                    if( data.length > 0 ){
                        $("#select1").html('');
                        var fcid = '';
                        $.each(data, function(i, item) {
                            if( i == 0 ){
                                fcid = item.class_id;
                            }
                            $("#select1").append(
                                '<option value="'+item.class_id+'">'+item.class_name+'</option>'
                            );
                            $('#category-id').val(fcid);
                        });
                    }else{
                        $("#select1").html('<option value="0">--</option>');
                        $('#category-id').val('');
                    }
                }
            });
        });

        $('#select1').change(function(){
            var v = parseInt($(this).val());
            if( v > 0 )
                $('#category-id').val( v );
        });
    })
</script>
                <input type="hidden" name="formhash" value="231cb4d8" />
                <input type="submit" class="btn_blue" value="查  询">
            </form>
        </div>
    </div>
    <div class="list">
        <form action="<?php echo U('Game/GameList', 'do=sort');?>" method="post" id="form_do" name="form_do">


            <table width="100%">
                <tr>
                    <th><input  name="chkall" type="checkbox" id="chkall" onClick="selectall(this.form)"></th>
                    <th>编号</th>
                    <th>标题</th>

                    <th>所属栏目</th>
                    <th>发布时间</th>
                    <th>修改时间</th>
                    <th>发布者</th>
                    <th>操作</th>
                </tr>

                <?php if(empty($vlist)): ?><tr>
                        <td colspan="9">本区域暂无数据显示...</td>
                    </tr>
                    <?php else: ?>
                    <?php if(is_array($vlist)): $i = 0; $__LIST__ = $vlist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                            <td><input type="checkbox" name="id[]" value="<?php echo ($v["game_id"]); ?>"></td>
                            <td><?php echo ($v["game_id"]); ?></td>
                            <td class="aleft">
                                <a href="javascript:;" target="_blank"><?php echo ($v["game_name"]); ?></a>
                            </td>
                            <td><?php echo ($v["class_name"]); ?></td>
                            <td><?php echo (date('Y-m-d H:i:s', $v["game_time_add"])); ?></td>
                            <?php if($v['game_time_update']): ?><td><?php echo (date('Y-m-d H:i:s', $v["game_time_update"])); ?></td>
                            <?php else: ?>
                                <td></td><?php endif; ?>
                            <td><?php echo ($v["game_belongto_user_id"]); ?></td>
                            <td>
                                <a href="<?php echo U('Game/Lists', 'do=edit&id='.$v['game_id']);?>">编辑</a>
                                <a href="<?php echo U('Game/Lists', 'do=delete&id='.$v['game_id']);?>" class="delete-one">删除</a>
                            </td>
                        </tr><?php endforeach; endif; else: echo "" ;endif; endif; ?>

            </table>
        </form>

    </div>

    <div id="page-list" style="text-align: center"></div>

</div>

<script type="text/javascript" src="/Public/Layerpage/laypage.js"></script>
<script type="text/javascript">
    laypage({
        cont: 'page-list',
        pages: <?php echo ($pages); ?>,
        first: 1,
        last: <?php echo ($pages); ?>,
        prev: '<',
        next: '>',
        curr: function(){
            var page = location.search.match(/page=(\d+)/);
            return page ? page[1] : 1;
        }(),
        jump: function(e, first){
            if(!first){
                location.href = page() + e.curr;
            }
        }
    });

    function page(){
        var u = location.href;
        var r = '';
        if(u.indexOf('&') > 0){
            r = location.href.replace(/&page=\d+/, '');
            return r + '&page=';
        }else if(u.indexOf('?') > 0 ){
            if(u.indexOf('?page') > 0 ){
                r = location.href.replace(/\?page=\d+/, '');
                return r + '?page=';
            }else{
                return r + '&page=';
            }
        }else{
            return location.href + '?page=';
        }
    }

    $('.delete-one').click(function(){
        if( ! window.confirm('确认要删除该游戏吗？') ){
            return false;
        }
    })
</script>
</body>
</html>